﻿@model Matrix.MaKaYunShang.Model.Industry
@{
    ViewBag.Title = "添加行业";
    ViewBag.PathToBtn = "/Industry/List";
    ViewBag.TextBtn = "返回至列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                行业信息
            </div>
            <div class="panel-body">
                <div class="row">
                    @using (Html.BeginForm("Create", "Industry", FormMethod.Post, new { id = "frmCreate", enctype = "multipart/form-data" }))
                    {
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true)
                        <div class="col-lg-12">
                            <fieldset>
                                <div class="form-group col-md-6">
                                    <label>父级行业</label>
                                    <div class="input-group">
                                        @Html.DropDownList("ParentId", (IEnumerable<SelectListItem>)ViewBag.ParentIndustryList, new { @class = "form-control" })
                                        <span class="input-group-addon"></span>
                                    </div>
                                </div>
                                <div class="form-group col-md-6">
                                    <label>行业名称</label>
                                    <div class="input-group">
                                        @Html.TextBoxFor(model => model.Name, new { @class = "form-control", placeholder = "行业名称" })
                                        <span class="input-group-addon red">必填</span>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <button id="btnSave" type="submit" class="btn btn-primary">确认并保存</button>
                                    <button id="btnReset" type="reset" class="btn btn-outline btn-primary">清空设置</button>
                                </div>
                            </fieldset>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>

@section javascript{
    <script type="text/javascript">
        $(function() {
            $("#frmCreate").validate({
                rules: {
                    Name: { required: true }
                },
                messages: {
                    Name: { required: "请填写行业名称" }
                },
                submitHandler: function (form) {
                    form.submit();
                }
            });
        });
    </script>
}